package com.app.mapper;

import com.app.model.UnitsRescueModel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UnitsRescueMapper extends BaseMapper<UnitsRescueModel> {
    //统计所有
    @Select("select count(*) as 'count' from tmp_units_rescue,lm_units_manager where tmp_units_rescue.rescue_id = lm_units_manager.id GROUP BY lm_units_manager.name)")
    List<Integer> getRescueAllCount();

    //统计各单位已办结的 动物救助任务统计
//    @Select("select count(a.real_name)as 'animalData' from lm_units_manager u left join lm_animal_rescue a on a.real_name=u.name where u.del=0 GROUP BY u.name")
    @Select("select count(a.real_name)as 'animalData' from lm_units_manager u left join lm_animal_rescue a on a.real_name=u.name where u.del=0 GROUP BY u.name order by u.id")
    List<Integer> getRescueCount();
}
